10 ' PATH MAN  by D N Smith based on:
20 '++++++++ PC MAN BY ED DAVIS +++++++
30 DIM S%(300)
35 COLOR 7,0:CLS
40 GOSUB 2790	 'color on
50 GOSUB 2150    'adjust paddles
60 GOSUB 1410	 'CREATE CHARACTERS
70 GOSUB 1770	 'INFO AND QUESTIONS
80 GOSUB 1050	 'INITIALIZATION
90 '************************************************************************
100 GOSUB 3000 ' read keys
110 IF INT(ZY/100)=0 THEN T=2
115 IF DNS$<"1" AND DNS$<>" " THEN GOTO 210
120 IF DNS$=" " THEN BT%=0 ELSE BT%=STRIG(1):IF BT%<>-1 GOTO 210
130 IF SS<1 GOTO 210
140 SHOT=0:IF DC=4 AND XC=XY AND YC>YY OR DC=3 AND YC=YY AND XC>XY OR DC=2 AND XC=XY AND YC<YY OR DC=1 AND YC=YY AND XC<XY THEN SHOT=1
150 PLAY "MBL64T255O5CDEFGAB"
160 SS=SS-1:LOCATE 23,5:PRINT"PHASOR SHOTS REMAINING >";SS;
165 DNS$ = "0"
170 IF SHOT=0 GOTO 210
180 PUT(XC*12,YC*12),GC%:PUT (XC*12,YC*12),BB%: PLAY"MFL64T200O1CEACEA"
190 FOR I=1 TO 300:NEXT I
200  PUT (XC*12,YC*12),BB%:XC=22-XC:YC=12-YC:PUT(XC*12,YC*12),GC%:DC=DC+2:IF DC>4 THEN DC=DC-4
210  PUT(12*XY,12*YY),G%
220 IF ABS(XY-11)>1 AND ABS (YY-6)>1 THEN 400
230   ON DY GOTO 240,280,320,360
240	IF XY=12 THEN 420
250     GOSUB 3000 ' read keys
260     Z=INT(ZX/100)-1:LY=LY+Z:YY=YY+Z:IF LY<1 OR LY>5 THEN LY=LY-Z:YY=YY-Z
270	GOTO 420
280   IF YY=5 THEN 420
290     GOSUB 3000 ' read keys
300     Z=INT(ZX/100)-1:LY=LY+Z:XY=XY-Z:IF LY<1 OR LY>5 THEN LY=LY-Z:XY=XY+Z
310	GOTO 420
320   IF XY=10 THEN 420
330     GOSUB 3000 ' read keys
340     Z=INT(ZX/100)-1:LY=LY+Z:YY=YY-Z:IF LY<1 OR LY>5 THEN LY=LY-Z:YY=YY+Z
350	GOTO 420
360   IF YY=7 THEN 420
370     GOSUB 3000 ' read keys
380     Z=INT(ZX/100)-1:LY=LY+Z:XY=XY+Z:IF LY<1 OR LY>5 THEN LY=LY-Z:XY=XY-Z
390     GOTO 420
400 IF ABS(XY-11)<LY+6 OR ABS(YY-6)<LY+1 THEN 420
410    DY=DY-1:IF DY=0 THEN DY=4
420 ON DY GOTO 430,440,450,460
430 XY=XY+1:GOTO 480
440 YY=YY+1:GOTO 480
450 XY=XY-1:GOTO 480
460 YY=YY-1
470 '
480 IF XY=XC AND YY=YC THEN GOSUB 1690: GOTO 100
490 IF RK>2 THEN IF XY=XD AND YY=YD THEN CCC=1:GOSUB 1690: GOTO 100
500 Z%=XY*13+YY:SZ%=S%(Z%):IF SZ%<1 THEN 560
510   SC=SC+(S%(Z%)-1)*4+1:C=C-1:LOCATE 12,16:PRINT SC
520   IF SZ%=1 THEN PLAY "MBL32T255O1D":PUT(XY*12,YY*12),M1%
530   IF SZ%=2 THEN PLAY "MBL32T255O2ACA":PUT(XY*12+1,YY*12+1),M%
540   S%(Z%)=0
550   IF C=0 THEN GOSUB 1110:GOTO 90 ' (JUMPS INTO INITIALIZATION ROUTINE)
560 IF T=2 THEN T=1:GOTO 400
570 PUT (XY*12,YY*12),G%
580 IF RK>2 THEN T=2:SW=1-SW:ON SW +1 GOTO 590,840
590 PUT(XC*12,YC*12),GC%
600 SZ%=S%(XC*13+YC)
610 IF SZ%=2 THEN PUT(XC*12+1,YC*12+1),M%,PSET
620 IF XC<>11 AND YC<>6 THEN 700
630 R=0:IF RND(1)<.3 THEN R=1
640 Z=SGN(LY-LC):LC=LC+Z
650 ON DC GOTO 660,670,680,690
660   YC=YC-Z:GOTO 720
670   XC=XC+Z:GOTO 720
680   YC=YC+Z:GOTO 720
690   XC=XC-Z:GOTO 720
700 IF ABS(XC-11)<LC+6 OR ABS(YC-6)<LC+1 THEN 720
710 DC=DC+1:IF DC=5 THEN DC=1
720 ON DC GOTO 730,740,750,760
730   XC=XC+1:GOTO 770
740   YC=YC+1:GOTO 770
750   XC=XC-1:GOTO 770
760   YC=YC-1
770 IF XC=XY AND YC=YY THEN GOSUB 1690 : GOTO 100
780 IF R=0 THEN 810
790 Z%=XC*13+YC:IF S%(Z%)=0 THEN C=C+1
800 S%(Z%)=2
810 IF TT=2 THEN TT=1:GOTO 590
820 PUT (XC*12,YC*12),GC%
830 GOTO 100
840 PUT (XD*12,YD*12),GC%
850 IF XD<>11 AND YD<>6 THEN 920
860 Z=SGN(LY-LD):LD=LD+Z
870 ON DD GOTO 880,890,900,910
880 YD=YD-Z:GOTO 940
890 XD=XD+Z:GOTO 940
900 YD=YD+Z:GOTO 940
910 XD=XD-Z:GOTO 940
920 IF ABS(XD-11)<LD+6 OR ABS(YD-6)<LD+1 THEN 940
930 DD=DD+1:IF DD=5 THEN DD=1
940 ON DD GOTO 950,960,970,980
950 XD=XD+1:GOTO 990
960 YD=YD+1:GOTO 990
970 XD=XD-1:GOTO 990
980 YD=YD-1
990 IF XD=XY AND YD=YY THEN CCC=1: GOSUB 1690 : GOTO 100
1000 IF TT=2 THEN TT=1:GOTO 840
1010 PUT (XD*12,YD*12),GC%
1020 GOTO 100
1030 END
1040 '***********************************************************************
1050 REM INITIALIZATION
1060 COLOR 0
1070 SCREEN 1,0
1080 HS=0:SC=0:SW=0
1090 IF SC>HS THEN HS=SC
1100 SC=0:RK=0:IF PK$="2" THEN RK=2
1110 C=200:RK=RK+1:SS=10:CCC=0
1115 ZX=100 : ZY = 0   : DELAY = 0
1118 DNS$="0"
1120 CLS
1125 WHILE INKEY$<>"" : WEND
1127 I = ASC(MID$(TIME$,7,1)) * ASC(MID$(TIME$,8,1))
1128 RANDOMIZE I
1130 FOR Y=0 TO 60 STEP 12
1140	LINE (Y,Y)-(276-Y,Y):LINE -(276-Y,156-Y):LINE -(Y,156-Y):LINE -(Y,Y)
1150 NEXT
1160 FOR Y=12 TO 48 STEP 12
1170	LINE (Y,65)-(Y,91),0
1180	LINE (276-Y ,65)-(276-Y,91),0
1190	LINE (125,Y)-(151,Y),0
1200	LINE (125,156-Y)-(151,156-Y),0
1210 NEXT
1220 FOR I=1 TO 299:S%(I)=0:NEXT I
1230 :
1240 FOR Y=0 TO 4
1250	FOR X=0 TO 9
1260	   PUT(12*X,12*Y),M1%:S%(13*X+Y)=1
1270	   PUT(264-12*X,12*Y),M1%:S%(13*(22-X)+Y)=1
1280	   PUT(12*X,144-12*Y),M1%:S%(13*X+(12-Y))=1
1290	   PUT(264-12*X,144-12*Y),M1%:S%(13*(22-X)+(12-Y))=1
1300 NEXT X:NEXT Y
1310 XC=10:YC=12:DC=3:LC=5:XY=12:YY=12:DY=1:LY=5
1320 PUT(XY*12,YY*12),G%
1330 PUT(XC*12,YC*12),GC%
1340 IF RK>2 THEN XD=10:YD=0:DD=1:LD=5:PUT(XD*12,YD*12),GC%
1350 LOCATE 10,15:PRINT"SCORE"
1360 LOCATE 11,15:PRINT"~~~~~"
1370 LOCATE 25,1:PRINT "    HIGHEST SCORE TODAY } ";HS;
1380 FOR I=1 TO 1000:NEXT I
1390 RETURN
1400 '*******************************************************************
1410 REM CREATE CARACTERS
1420 DIM G%(18):DIM GC%(18):DIM M%(18):DIM M1%(18):DIM BB%(80)
1430 CLS
1440 SCREEN 1,0:COLOR 0,1:OUT 980,2:OUT 981,43
1450 LINE (103,103)-(107,107),2,BF
1460 GET(100,100)-(109,109),M%
1470 CLS
1480 CIRCLE (105,105),5,3
1490 PAINT (105,105),2,3
1500 GET(100,100)-(110,110),GC%
1510 REM PAINT MAN +++++++++++++++++
1520 CLS
1530 ' LINE (100,100)-(110,110),3,B
1540 PRESET (100,100):DRAW"C3S4"
1550 DRAW"BR3R4D2L1D1R4D2L4D1R1D2R2D2L3U2L2D2L3U2R2U4L3U2R4U1L1U2"
1560 PAINT (105,103),3,3
1570 GET (100,100)-(110,110),G%
1580 CLS
1590 LINE(105,103)-(105,107),3
1600 LINE(103,105)-(107,105),3
1610 GET(100,100)-(110,110),M1%
1620 CLS
1630 CIRCLE (110,110),10,3
1640 PAINT (110,110),2,3
1650 GET (100,100)-(120,120),BB%
1660 CLS
1670 RETURN
1680 '*************************************************************
1690 REM BLOW UP SEQUENCE ON COLLISION
1700 PLAY"MB L32T64O1EAEAEAEA"
1710 IF RK>2  AND CCC=1 THEN PUT (XD*12,YD*12),BB%,PRESET:GOTO 1730
1720 PUT(XC*12,YC*12),BB%,PRESET
1730 PLAY"L64O1AP10BP30CP20FEA"
1735 LOCATE 10,12:PRINT "Hit <CR>..."
1740 IF INKEY$<>CHR$(13) THEN 1740
1750 GOSUB 1090
1755 RETURN
1760 '**************************************************************************
1770 ' INFO AND QUESTIONS
1780 CLS
1790 LOCATE 1,3:PRINT "WELCOME TO THE GAME OF   PATH MAN"
1800 LOCATE 4,2:PRINT " Using the keys you will be":PRINT " moving a man thru a maze filled with
1810 PRINT""
1820 PRINT "   GOOD THINGS, AND BAD PEOPLE."
1830 PRINT""
1840 PRINT"  Push the "8" for fast; "2" for slow.
1850 PRINT"  Push space bar to FIRE phasor.
1860 PRINT"  You only have 10 shots !"
1865 PRINT"  1 & 4 & 7 turn left 1, 2, or 3 rows.
1867 PRINT"  3 & 6 & 7 turn right 1, 2, or 3 rows.
1870 PRINT"  The more you eat the higher your score"
1880 PRINT"  The bad guys only want to eat YOU!"
1890 PRINT"  Every once in a while a bad guy may "
1900 PRINT"  drop some special food... "
1910 PRINT" ":PRINT"   Hope you enjoy yourself."
1920 PRINT"           Ed Davis & Dave Smith"
1930 LOCATE 25,4:PRINT "press space bar to continue";:I$=INKEY$
1940 IF I$<>" "GOTO 1930
1950 CLS
1960 PRINT" ":PRINT"~~~~~THE CAST OF CHARACTERS~~~~~"
1970  LOCATE 5,2:PRINT "                  YOU>"
1980  LOCATE 7,2:PRINT "         THE BAD GUYS>"
1990  LOCATE 9,2:PRINT "FOOD  (WORTH 1 POINT)>"
2000  LOCATE 11,2:PRINT"FOOD (WORTH 5 POINTS)>"
2010 PUT (200,30),G%
2020 PUT (200,46),GC%
2030 PUT (200,62),M1%
2040 PUT (200,78),M%
2050 LOCATE 19,3:PRINT "YOU MAY START IN THE CAGE WITH EITHER"
2060 LOCATE 20,3:PRINT "ONE OR TWO OF THE 'BAD GUYS'.
2070 LOCATE 22,3:PRINT"HOW MANY DO YOU WISH (1 OR 2) ?";:PK$=INKEY$
2080 RK=0
2090 IF PK$="1" THEN RK=1 :RETURN
2100 IF PK$="2" THEN RK=2: RETURN
2110 GOTO 2070
2120 END
2130 '******************************************************************
2140 '       joystick adjustment
2150 CLS:KEY OFF:STRIG ON
2155  IF STICK(0)=0 THEN RETURN
2160 LOCATE 25,5:PRINT " PRESS ANY KEY TO END THIS TEST"
2170 LOCATE 3,5:PRINT"THIS GAME REQUIRES A JOYSTICK":PRINT
2180 PRINT "HOLD JOYSTICK  SUCH THAT AS YOU MOVE IT
2190 PRINT "LEFT AND RIGHT, UP AND DOWN, AND WHEN "
2200 PRINT"YOU PRESS THE BUTTON YOU GET"
2210 PRINT "THE CORRECT RESPONSES BELOW........
2220 K$=INKEY$: IF K$<>""THEN RETURN
2230 SX=STICK(0):SY=STICK(1)
2240 LOCATE 10,10: PRINT"X VAL.     Y VAL. "
2250 REM ~~~~~~~~~~~~NOTE DECISION VALUE SET AT 50~~~~~~~~~~~~~~
2260 LOCATE 11,10:PRINT SX;"       ";SY;"   "
2270  ZX=INT(SX/50)  :ZY=INT(SY/50)
2280  IF ZX=0 THEN M$="  <<<< LEFT HAND TURN         "
2290  IF ZX=1 THEN M$="    ^  STAIGHT AHEAD  ^       "
2300 IF ZX=2 THEN M$="       RIGHT HAND TURN >>>>   "
2310 IF ZY=0 THEN MM$=" FASTER      "
2320 IF ZY<>0 THEN MM$="NORMAL SPEED"
2330 LOCATE 15,4:PRINT M$
2340 LOCATE 17,11:PRINT MM$
2350 BT%=STRIG(1)
2360 LOCATE 20,8:PRINT "                   "
2370 IF BT%=-1 THEN LOCATE 20,8:PRINT"BUTTON IS PRESSED!"
2380 GOTO 2220
2390 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2400 '
2410 '          REMARKS
2420 '
2430 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2440 '
2450 ' WRITTED BY ED DAVIS ,BURLINGTON
2460 '    EXTENSION (8-446)-2091
2470 '   FROM IDEAS BY M. PELCZARSKI
2480 '           1-1-81
2490 '
2500 ' NOTE LINE 2030 USES "OUT" COMMANDS
2510 ' TO SHIFT THE SCREEN LEFT, IF YOU
2520 ' ARE USING A MONITOR YOU MAY WISH
2530 ' TO REMOVE THESE.  ALSO THE SENSI-
2540 ' TIVITY OF THE PADDLES MAY BE
2550 ' CHANGED ON LINES 61 AND 87.
2560 '
2570 '
2580 END
2590 '*******************************************************************
2600 ' COLOR MONITOR-MONOCHROME MONITOR SWITCH    EMD 11-81
2610 CLS
2620 PRINT:PRINT"IF YOU WANT TO TOGGLE MONOCHROME/COLOR  THEN;"
2630 PRINT"   FOR COLOR PRESS - C"
2640 PRINT"   FOR MONO  PRESS - M"
2650 PRINT"   FOR NO CHANGE PRESS ANY OTHER KEY."
2660 K$=INKEY$:IF K$="" GOTO 2660
2670 IF K$="C" OR K$="c" THEN GOSUB 2790:END
2680 IF K$="M" OR K$="m" THEN GOSUB 2710:END
2690 CLS
2700 PRINT"@@@@@@@@@@@@    NO CHANGE   @@@@@@@@@@@@@@":END
2710 '************** switch to monochrome ***************************
2720 DEF SEG=0
2730 POKE &H410,(PEEK(&H410) OR &H30)
2740 DEF SEG
2750 LOCATE ,,1,12,13
2760 SCREEN 0 : WIDTH 80
2770 RETURN
2780 '***************************************************************8
2790 REM switch to color/graphics adapter
2800 DEF SEG=0
2810 POKE &H410,(PEEK(&H410) AND &HCF) OR &H20
2820 DEF SEG
2830 LOCATE ,,1,6,7
2840 SCREEN 0
2850 WIDTH 40
2860 RETURN
3000 'ZX = 50 : ZY = 50
3020 XXX$ = INKEY$ : IF XXX$<>"" THEN DNS$ = XXX$
3025 IF DNS$="m" THEN GOSUB 2710 : STOP
3030 LOCATE 23,35 : PRINT DNS$;
3040 IF DNS$="9" THEN ZX=405
3045 IF DNS$="6" THEN ZX=305
3047 IF DNS$="3" THEN ZX=205
3060 IF DNS$="8" THEN            : ZY = 0
3065 IF DNS$="5" THEN ZX = 100
3070 IF DNS$="2" THEN            : ZY = 400
3080 IF DNS$="7" THEN ZX= -200
3085 IF DNS$="4" THEN ZX= -100
3090 IF DNS$="1" THEN ZX=  0
3200 RETURN
